<#include "/WEB-INF/fragment/head.ftl">

 <style type="text/css"> 
    .head{background-color: rgb(208,14,49);padding-bottom: 10px;padding-top: 10px;margin-bottom: 0px;color: white;}
    .login{background-color: gray;padding: 4px;}
    .login-fr{padding-right: 10px;}
    .title{padding-left:  20px;font-size: 18px;}
    .pic{padding-top: 80px;padding-left: 100px;}
    .input{padding-top: 10px;}
    input{width: 350px;padding: 10px;margin: 10px;}
    a>img{width: 110px;height: 60px;} 
    .underline{height: 2px;width: 1140px;background-color: red;margin-top: 10px;}
  .create-team{color: black;}  
  .myteam{padding: 5px 20px;margin-right: 10px;color: white;background-color: rgb(0,128,0);  }  
  .save{padding: 5px 20px;margin-right: 10px;color: white;background-color: rgb(22,155,213);  }  
  .invate{padding: 5px 20px;margin-right: 10px;color: white;background-color: rgb(51,51,51);  }
    </style>
<body>
     <div class="container">
     <div class="head clearfix">
            <div class="title fl"><a href="${request.contextPath}/index">教学过程控制系统</a></div>
            <div class="login-fr fr"><a href="${request.contextPath}/_register1"><img src="./assets/img/joinus.png"></a></div>
        </div>
        <div>
        <div class="pic fl"><img src="http://172.16.1.55/logo.png"></div>
        <div class="input fr">
        <form class="form-submit" method="post">
            <div><img src="http://172.16.1.55/logo.png"></div>
                <div align="center"><input class="in j_check" type="text" name="name" placeholder="名字" value="aaa"><span></span><p>
            ${FieldErrors['name']!""}
            </p></div>
                <div align="center"><input class="in j_passwd" type="text" name="passwd" placeholder="密码" value="123456"><span></span><p>
            ${FieldErrors['passwd']!""}
            </p></div>
                <div><input type="checkbox" name="remeberMe" value="1">下次自动登录</div>
                <div align="center"><button type="submit" class="btn">立即登录</button></div>
        </form>
         </div>
            </div>
     </div>
      <script type="text/javascript">
    
    $(document).on('submit', '.form-submit', function(event) {
       var param = $('.form-submit').serialize();
  param = param + '&struts.enableJSONValidation=true';
  $.post('${request.contextPath}/login.action', param, function(data, textStatus, xhr) {
    if(data['fieldErrors'] != null) {
      for (var i in data['fieldErrors']) {
        $('input[name="'+i+'"]').next().html(data['fieldErrors'][i]);
      }
      return;
    }

    if (data['status'] === 1) {
      window.location.href = '${request.contextPath}/index.action';
    }
    if (data['status'] === 2) {
      alert(data['message']);
    }
  });
  return false;
});
    
    </script>
</body>
</html>